<%-- 
    Document   : viewSampleData
    Created on : Nov 23, 2009, 10:51:02 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>View sample data</title>
    </head>
    <body>
        <h1>Sample roles!</h1>
        <jsp:useBean id="roles" class="java.util.List<sgt.onlinetest.entity.Role>" scope="request"/>
        <table border="1">
            <tr><th>Role Auto Id</th><th>Role Name</th></tr>
            <% for (sgt.onlinetest.entity.Role r : roles) {%>
            <tr><td><%=r.getAutoId()%></td><td><%=r.getName()%></td></tr>
            <%}%>
        </table>

        <h1>Sample users!</h1>
        <jsp:useBean id="users" class="java.util.List<sgt.onlinetest.entity.User>" scope="request"/>
        <table border="1">
            <tr><th>User Auto Id</th><th>User Name</th><th>User Fullname</th><th>User Password</th><th>Assigned roles</th></tr>
            <% for (sgt.onlinetest.entity.User u : users) {%>
            <tr><td><%=u.getAutoId()%></td><td><%=u.getUsername()%></td>
                <td><%=u.getFullname()%></td><td><%=u.getPassword()%></td>
                <td><% for (sgt.onlinetest.entity.Role r : u.getRoles()) {%>
                    <%=r.getName()%>
                    <%}%></td>
            </tr>
            <%}%>
        </table>

        <h1>Sample Questions</h1>

        <jsp:useBean id="questions" class="java.util.List<sgt.onlinetest.entity.Question>" scope="request"/>
        <table border="1">
            <tr><th>Question Auto Id</th><th>Question Content</th><th>Question Options</th></tr>
            <% for (sgt.onlinetest.entity.Question q : questions) {%>
            <tr><td><%=q.getAutoId()%></td><td><%=q.getContent()%></td>
                <td><% for (sgt.onlinetest.entity.QuestionOption o : q.getOptions()) {%>
                    <%=o.getContent()%><%=o.isCorrect() ? "(Correct)" : ""%>
                    <%}%></td>
            </tr>
            <%}%>
        </table>

    </body>
</html>
